"""快速排序"""
def fast(lst,min,max):
    if min<max:
        i=min
        j=max
        p=lst[min]
        while i!=j:
            while j>i and lst[j]>p:
                j=j-1
            if j>i:
                lst[i],lst[j]=lst[j],lst[i]
                i=i+1
            while i < j and lst[i]<p:
                i=i+1
            if i<j:
                lst[j],lst[i]=lst[i],lst[j]
                j=j-1
        lst[i]=p
        fast(lst,min,i-1)
        fast(lst,i+1,max)
        return lst
    
    

def sort(lst):
    if len(lst)<2:
        return lst
    else:
        p = lst[0]
        left = []
        right = []
        middle = []
        for i in lst:
            if i > p:
                right.append(i)
            elif i < p:
                left.append(i)
            else:
                middle.append(i)
        left = sort(left)
        right = sort(right)
        return left+middle+right







